<?php

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

//授权路由
Route::group(['middleware' => ['web'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function () {
    Auth::routes();
});


//需要授权的路由
Route::group(['middleware' => ['web', 'auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function () {
    // 主页
    Route::get('/', 'AdminController@index');

    //角色管理
    Route::resource('role', 'RoleController')->middleware('permission:admin,resource');
    Route::get('role/permission/{role}', 'RoleController@permission')->middleware('permission:admin');
    Route::post('role/permission/{role}', 'RoleController@permissionStore')->middleware('permission:admin');


});


//module-route
Route::group(['middleware' => ['web', 'auth:admin'], 'prefix' => 'admin', 'namespace' => "Modules\Admin\Http\Controllers"],
    function () {
        Route::get('module/update_module_cache', 'ModuleController@updateCache');
        Route::get('module/set_module_default/{module}', 'ModuleController@setDefault');
        Route::resource('module', 'ModuleController');
    });
